package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.OtherRoundPeriodConfig;
import com.ruoyi.system.domain.OtherTakeLeaveConfig;
import com.ruoyi.system.domain.OthertoptaskConfig;
import com.ruoyi.system.mapper.OtherRoundPeriodConfigMapper;
import com.ruoyi.system.mapper.OtherTakeLeaveMapper;
import com.ruoyi.system.service.IOtherRoundPeriodConfigService;
import com.ruoyi.system.service.IOtherTakeLeaveService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DataSource(value = DataSourceType.SLAVE)
public class OtherRoundPeriodConfigServiceImpl extends ServiceImpl<OtherRoundPeriodConfigMapper, OtherRoundPeriodConfig> implements IOtherRoundPeriodConfigService {

    @Resource
    OtherRoundPeriodConfigMapper otherRoundPeriodConfigMapper;

    @DataSource(value = DataSourceType.SLAVE)
    public String getZcStr(String roomId) {
        List<OtherRoundPeriodConfig> otherRoundPeriodConfigList = otherRoundPeriodConfigMapper.selectList(new LambdaQueryWrapper<OtherRoundPeriodConfig>().eq(OtherRoundPeriodConfig::getRoomID, roomId));

        StringBuilder rsp = new StringBuilder();
        for (OtherRoundPeriodConfig otherRoundPeriodConfig : otherRoundPeriodConfigList) {
            rsp.append(otherRoundPeriodConfig.getRoundPeriodString()).append(" ").append(otherRoundPeriodConfig.getHostDisplayNames()).append("\n");
        }
        return  rsp.toString();
    }


}
